/*
 * @Description: 保存检索方案弹窗
 * @Author: Zzt
 * @Date: 2022-08-31 18:21:27
 * @LastEditTime: 2022-09-13 20:33:03
 */

import { useEffect, useState } from 'react';
import { Form, Input, Modal } from 'antd';
import FormItem from 'antd/es/form/FormItem';
import TextArea from 'antd/lib/input/TextArea';

const SaveCondition = (props: any) => {
  const { visible, onClose, data } = props;
  const { param } = data.params;
  const [values, setValues] = useState(data);
  // const [fondid, setFondid] = useState('');
  useEffect(() => {
    setValues(data);
    // setFondid(
    //   param.atConditionList.map((at: any) => {
    //     return at.fondId;
    //   })
    // );
  }, [visible]);
  // const conditions = () => {
  //   const condition = `pageNo:'${values.params.pageNo}',pageSize:'${
  //     values.params.pageSize
  //   }',param:atConditionList:fondId:'${param.atConditionList.map((at: any) => {
  //     return at.fondId;
  //   })}'archiveTypeIdList:'${param.atConditionList.map((at: any) => {
  //     return at.archiveTypeIdList;
  //   })}',commonParams.dbName:'${param.commonParams.dbName}'`;
  //   return condition;
  // };
  console.log(values);

  const [form] = Form.useForm();
  const onFinish = () => {
    form.resetFields();
  };
  return (
    <Modal title="保存到检索方案" visible={visible} onOk={onClose} onCancel={onClose}>
      <Form
        // initialValues={{ condition: conditions() }}
        labelCol={{ span: 5 }}
        wrapperCol={{ span: 16 }}
        onFinish={onFinish}
        form={form}
      >
        <FormItem label="名称" name="name" required>
          <Input />
        </FormItem>
        <FormItem label="条件" name="condition">
          <TextArea rows={4} />
        </FormItem>
      </Form>
    </Modal>
  );
};
export default SaveCondition;
